<%@ page import="java.net.*"%>

<%

 String serverName = request.getServerName() ;
 int port = request.getServerPort() ;
 String path = request.getContextPath();
 
 String spiceDocuName = "spiceDocuSkipp";
 String showSpice = request.getParameter("showSpice");
 String value = "false";
if ( showSpice != null) {
   if (showSpice.equals("0")) 
     value = "true";
}
 Cookie c = new Cookie(spiceDocuName,value);
 int max_age_seconds = 60*60*24*7*4;  // 4 weeks
 c.setMaxAge(max_age_seconds);
 response.addCookie(c);
 
 String queryS = request.getParameter("queryS"); 

 if ( queryS != null ) {
   // String redirectURL = "http://" + serverName + ":" + port + path + "/runspice.jsp?" + queryS;
   String redirectURL = "runspice.jsp?" + queryS;
   response.sendRedirect(redirectURL);
 } else {
   response.sendRedirect("runspice.jsp");
 }
 
%>
